{{> headers/_Title title="console.authentication.modules.title" }}

<p class="page-description">{{t "console.authentication.modules.description"}}</p>
<div class="btn-toolbar page-toolbar">
    <a class="btn btn-primary" href="{{routeTo 'realmsAuthenticationModuleNew' realmPath}}">
        <i class="fa fa-plus"></i> {{t 'console.authentication.modules.addModule'}}
    </a>
    <button disabled class="btn btn-default" data-delete-modules type="button"><i class="fa fa-times"></i> {{t 'common.form.delete'}}</button>
</div>

<div class="panel panel-default">
    <div class="panel-body">
        <div class="table-container">
            <table class="table">
                <thead>
                    <tr>
                        <th class="select-all-header-cell"></th>
                        <th>{{t "console.authentication.modules.moduleName"}}</th>
                        <th>{{t "console.authentication.modules.moduleType"}}</th>
                        <th>{{t "console.authentication.modules.chain"}}</th>
                        <th class="fr-col-btn-2"></th>
                    </tr>
                </thead>
                <tbody>
                    {{#each this.formData}}
                    <tr data-module-name="{{_id}}" data-module-type="{{type}}" data-module-chains="{{chains}}">
                        <td class="select-row-cell"><input data-select-module type="checkbox" {{#if chains}}disabled{{/if}}/></td>
                        <td class="wordwrap">
                            <a href="{{routeTo 'realmsAuthenticationModuleEdit' ../realmPath type _id}}" title="{{t 'common.form.edit'}}" {{#if chains}}class="check-before-edit"{{/if}}>{{_id}}</a>
                        </td>
                        <td>{{typeDescription}}</td>

                        <td class="wordwrap">
                            {{#each chains}}
                            <a href="{{routeTo 'realmsAuthenticationChainEdit' ../../realmPath this}}">{{this}}</a><br>
                            {{/each}}
                        </td>
                        <td class="fr-col-btn-2">
                            <div class="btn-group">
                                <a class="btn btn-link" {{#if chains}}data-check-before-edit{{/if}} href="{{routeTo 'realmsAuthenticationModuleEdit' ../realmPath type _id}}"  title="{{t 'common.form.edit'}}"><i class="fa fa-pencil"></i></a>
                                <button type="button" class="btn btn-link" data-delete-module {{#if chains}}disabled{{/if}}>
                                    <i class="fa fa-close" {{#unless chains}}title="{{t 'common.form.delete'}}"{{/unless}}></i>
                                </button>
                            </div>
                        </td>
                    </tr>
                    {{/each}}
                </tbody>
            </table>
        </div>
    </div>
</div>
